package org.urbansoft.icl.record;

import java.util.ArrayList;
import org.apache.log4j.Logger;
import org.urbansoft.icl.field.Field;
import org.urbansoft.icl.field.GenericANField;
import org.urbansoft.icl.field.Position;
import org.urbansoft.icl.field.validation.RecordTypeValidator;

/**
 * 
 * @author Ricardo Reyes
 */
public class ReturnAddendumD3505 extends Record {

	static Logger log = Logger.getLogger(BundleControlRecord.class);

	public Field recordType;
	public Field recordNumber;
	public Field accountSigner;
	public Field accountSignerRUT;
	public Field reserved;

	public ReturnAddendumD3505() {
		// log.info("New ReturnAddendumD3505 ");
		fields = new ArrayList<Field>();
		recordName = "Return AddendumD 3505";
		recordTypeNumber = "35";
		initFields();
	}

	/**
	 * Inits the fields for read.
	 */
	private void initFields() {
		try {
			/* check detail record */

			recordType = new GenericANField(new Position(1, 2),
					RecordTypeValidator.INSTANCE, "35", "Record Type");

			/* recordNumber es 01 */
			recordNumber = new GenericANField(new Position(3, 4),
					"Record Number");
			recordNumber.setFieldData("05");

			/* accountHolderName */
			accountSigner = new GenericANField(new Position(5, 64),
					"Account Signer");
			accountSigner.setFieldData("S2");

			/* accountHolderRUT */
			accountSignerRUT = new GenericANField(new Position(65, 74),
					"Account Signer RUT");
			accountSignerRUT.setFieldData("91");

			/* accountHolderRUT */
			reserved = new GenericANField(new Position(75, 90), "Reserved");
			reserved.setFieldData("");

			fields.add(recordType);
			fields.add(recordNumber);
			fields.add(accountSigner);
			fields.add(accountSignerRUT);
			fields.add(reserved);

		} catch (Exception e) {
			log.fatal(e.getMessage(), e);
		}
	}

}
